package com.shaoshaohuo.app.adapter;

import java.util.List;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.shaoshaohuo.app.R;
import com.shaoshaohuo.app.entity.PointMall;
import com.shaoshaohuo.app.utils.ImageLoadUtil;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

public class PointMallItemAdapter<T> extends MyBaseAdapter<PointMall> {

	public PointMallItemAdapter(Context ctx, List<PointMall> list, boolean flag) {
		super(ctx, list, flag);
	}

	@Override
	public View getView(int pos, View convertView, ViewGroup group) {

		ViewHolder holder;
		if (convertView == null) {
			convertView = View.inflate(context, R.layout.view_point_mall_item, null);
			holder = new ViewHolder();
			holder.titleText = (TextView) convertView.findViewById(R.id.textview_title);
			holder.pointText = (TextView) convertView.findViewById(R.id.textview_point);
			holder.imageView = (ImageView) convertView.findViewById(R.id.imageview_image);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}

		PointMall msg = list.get(pos);

		holder.titleText.setText(msg.getTitle());
		holder.pointText.setText(msg.getIntegral() + "积分");

//		LoadUtils.getInstance().loadImage(holder.imageView, msg.getImg());
		ImageLoader.getInstance().displayImage(msg.getImg(), holder.imageView,ImageLoadUtil.build);
		return convertView;
	}

	static class ViewHolder {
		ImageView imageView;
		TextView titleText;
		TextView pointText;
	}

}
